<template>
  <div class="six-months">
    <div class="title">包裹类型库存剩余数</div>
    <div class="chart" id="sixChart"></div>
  </div>
</template>

<script>
export default {
  name: "six-months",
  data() {
    return {
      option: {
        tooltip: {
          show: true,
          trigger: "axis",
          axisPointer: {
            type: "cross",
            label: {
              backgroundColor: "#6a7985",
            },
          },
        },
        grid: {
          left: "3%",
          right: "4%",
          bottom: "3%",
          containLabel: true,
        },
        xAxis: [
          {
            type: "category",
            boundaryGap: false,
            data: ["周一", "周二", "周三", "周四", "周五", "周六", "周日"],
            axisLabel: {
              color: "#FFFFFF",
              fontSize: "18",
              margin: 15,
            },
            axisLine: {
              show: true,
              lineStyle: {
                color: "#1C53AC",
                width: 2,
              },
            },
            axisTick: {
              show: false,
            },
          },
        ],
        yAxis: [
          {
            type: "value",
            axisLabel: {
              color: "#FFFFFF",
              fontSize: "18",
              margin: 10,
            },
            axisLine: {
              show: true,
              lineStyle: {
                color: "#1C53AC",
                width: 2,
              },
            },

            splitLine: {
              show: false,
            },
          },
        ],
        series: [
          {
            name: "邮件营销",
            type: "line",
            itemStyle: {
              normal: {
                color: "#00ED3B",
                lineStyle: {
                  //线的颜色
                  color: "#00ED3B",
                },
              },
            },
            areaStyle: {
              type: "default",
              //渐变色实现===
              color: this.$echarts.graphic.LinearGradient(
                0,
                0,
                0,
                1,
                //三种由深及浅的颜色
                [
                  {
                    offset: 0,
                    color: "#00ED3B",
                  },
                  {
                    offset: 1,
                    color: "rgba(0, 237, 59, 0)",
                  },
                ]
              ),
            },
            lineStyle: {
              //线的颜色
              color: "#00ED3B",
            },
            emphasis: {
              focus: "series",
            },
            smooth: true,
            data: [120, 132, 101, 134, 90, 230, 210],
          },
          {
            name: "搜索引擎",
            type: "line",
            itemStyle: {
              normal: {
                color: "#09D4FF",
                lineStyle: {
                  //线的颜色
                  color: "#09D4FF",
                },
                areaStyle: {
                  type: "default",
                  //渐变色实现===
                  color: this.$echarts.graphic.LinearGradient(
                    0,
                    0,
                    0,
                    1,
                    //三种由深及浅的颜色
                    [
                      {
                        offset: 0,
                        color: "#09D4FF",
                      },
                      {
                        offset: 1,
                        color: "rgba(9, 212, 255, 0)",
                      },
                    ]
                  ),
                },
              },
            },

            smooth: true,
            emphasis: {
              focus: "series",
            },
            data: [820, 932, 901, 934, 1290, 1330, 1320],
          },
        ],
      },
    };
  },
  mounted() {
    const chartDom = document.getElementById("sixChart");
    const myChart = this.$echarts.init(chartDom);
    myChart.setOption(this.option);
  },
};
</script>

<style lang="scss" scoped>
.six-months {
  width: 926px;
  height: 496px;

  .title {
    height: 60px;
    line-height: 60px;
    padding-left: 33px;
    font-weight: bold;
    font-size: 24px;
    color: #ffffff;
  }
  .chart {
    height: 436px;
  }
}
</style>